package util;

import java.awt.geom.Point2D;

public final class Point {
	private final int x;
	private final int y;

	public Point(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public double distance(Point otherPoint) {
		int xDistance = x - otherPoint.getX();
		int yDistance = y - otherPoint.getY();
		return Math.sqrt(xDistance * xDistance + yDistance * yDistance);
	}

	public Point2D getPoint2D() {
		return new Point2D.Double(x, y);
	}

	@Override
	public String toString() {
		return "Point[x=" + x + ",y=" + y + "]";
	}

}
